﻿namespace WMS6.Web.Inbound
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class ReceivingQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected Button Button1;
        protected Button Button2;
        protected Button Button3;
        protected DropDownList ddlASNIDOper;
        protected DropDownList ddlCarrierOper;
        protected DropDownList ddlDiffQty;
        protected DropDownList ddlExternalASNIDOper;
        protected DropDownList ddlOwnerIDOper;
        protected DropDownList ddlPoID;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTypeOper;
        protected DropDownList ddlVendorIDOper;
        protected DropDownList ddlVendorNameOper;
        protected DropDownList DropDownList1;
        protected HtmlForm F4020;
        protected HtmlInputHidden hdnActionID;
        protected Label lblASN;
        protected Label lblASNID;
        protected Label lblCarrier;
        protected Label lblDiffQty;
        protected Label lblExternalASNID;
        protected Label lblOwnerID;
        protected Label lblPoID;
        protected Label lblStatus;
        protected Label lblType;
        protected Label lblVendorID;
        protected Label lblVendorName;
        protected MultipleSelectControl MSCStatus;
        protected MultipleSelectControl MSCType;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtASNID;
        protected TextBox txtCarrier;
        protected TextBox txtExternalASNID;
        protected TextBox txtOwnerID;
        protected TextBox txtPoID;
        protected TextBox txtVendorID;
        protected TextBox txtVendorName;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("ReceivingList.aspx", false);
        }

        private void InitDropDownLists()
        {
            base.BindData2DDLBySysCode(this.MSCStatus, "ReceiptStatus");
            base.BindData2DDLBySysCode(this.MSCType, "ReceiptType");
            base.InitQueryDDL(this.ddlASNIDOper, 0);
            base.InitQueryDDL(this.ddlPoID, 0);
            base.InitQueryDDL(this.ddlVendorIDOper, 0);
            base.InitQueryDDL(this.ddlVendorNameOper, 0);
            base.InitQueryDDL(this.ddlExternalASNIDOper, 0);
            base.InitQueryDDL(this.ddlOwnerIDOper, 0);
            base.InitQueryDDL(this.ddlCarrierOper, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            this.ddlStatusOper.SelectedValue = "One Of";
            base.InitQueryDDL(this.ddlTypeOper, 0);
            this.ddlTypeOper.SelectedValue = "One Of";
            this.ddlDiffQty.Items.Clear();
            this.ddlDiffQty.Items.Add(new ListItem("-----", ""));
            this.ddlDiffQty.Items.Add(new ListItem("0", " = 0 "));
            this.ddlDiffQty.Items.Add(new ListItem("非0", " <> 0 "));
            this.ddlDiffQty.Items.Add(new ListItem("大于0", " > 0"));
            this.ddlDiffQty.Items.Add(new ListItem("小于0", " < 0"));
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnNew.Visible = false;
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string ASNID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtASNID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtASNID.Text.Trim(), this.ddlASNIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string CarrierID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCarrier.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCarrier.Text.Trim(), this.ddlCarrierOper.SelectedValue);
                }
                return "";
            }
        }

        public string DiffQty
        {
            get
            {
                return this.ddlDiffQty.SelectedValue;
            }
        }

        public string ExternalASNID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternalASNID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternalASNID.Text.Trim(), this.ddlExternalASNIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string PoID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPoID.Text))
                {
                    return base.GetParamsString(this.txtPoID.Text, this.ddlPoID.SelectedValue);
                }
                return "";
            }
        }

        public string ReceiptType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCType.ReturnValue))
                {
                    return base.GetParamsString(this.MSCType.ReturnValue, this.ddlTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string VendorID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    return base.GetParamsString(this.txtVendorID.Text, this.ddlVendorIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string VendorName
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtVendorName.Text))
                {
                    return base.GetParamsString(this.txtVendorName.Text, this.ddlVendorNameOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

